<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">

<div th:replace="include/header::head"></div>

<div th:replace="include/teacher_navbar::navbar(${loginTeacher})"></div>

<div class="container">
	<h1>
		<img th:src="@{/static/img/exam-teacher.png}" /> 上机考试管理
	</h1>

	<p class="exam-info">完成学生名单的导入和修改后，
		<a class="btn" th:href="@{'/teacher/exam/modify/'+ ${examId}}"><i class="icon-edit"></i>返回编辑</a>
	</p>

	<form class="exam-form form-inline" id="addStudentForm" th:action="@{/teacher/student/insert}" method="post">
		<h4>添加单个学生</h4>
		<input type="text" name="number" placeholder="学号*" size="20" />
		<input type="text" name="name" placeholder="姓名*" size="20" />
		<input type="text" name="studentClass" placeholder="班级" size="20" />
		<input type="hidden" name="examId" th:value="${examId}" />
		<input type="submit" id="addStudent" class="btn btn-primary" value="添加" />
	</form>

	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span6">
				<form class="form-inline" th:action="@{/teacher/student/changePageSize}" method="post">
					<input type="hidden" name="examId" th:value="${examId}" />
					分页大小 <input type="text" name="pageSize" th:value="${config.pagesize}" class="input-small" />
					<input type="submit" class="btn" value="设置"/>
				</form>
			</div>
			<div class="pull-right">
				<form class="form-inline" th:action="@{/teacher/student/changePage}" method="post">
					<a title="第一页"
					   th:href="@{'/teacher/student/' + ${examId} + '/1'}"
					   th:classappend="${page.current == 1} ? 'btn disabled' : 'btn'">
						<i class="icon-fast-backward"></i>
					</a>
					<a title="前一页"
					   th:href="@{/teacher/student/{eid}/{pageNumber}(eid=${examId}, pageNumber=${page.current}-1)}"
					   th:classappend="${page.current == 1} ? 'btn disabled' : 'btn'">
						<i class="icon-step-backward"></i>
					</a>
					<input type="hidden" name="eid" th:value="${examId}" />
					<input type="text" name="pageNo"
						   th:placeholder="${page.current} + '/' + ${page.pages}"
						   class="input-small" />
					<button type="submit" title="前往" class="btn">
						<i class="icon-play"></i>
					</button>
					<a title="后一页"
					   th:href="@{/teacher/student/{eid}/{pageNumber}(eid = ${examId},pageNumber = ${page.current}+1) }"
					   th:classappend="${page.current == page.pages} ? 'btn disabled' : 'btn'">
						<i class="icon-step-forward"></i>
					</a>
					<a title="最后一页"
					   th:href="@{'/teacher/student/' + ${page.pages}}"
					   th:classappend="${page.current == page.pages} ? 'btn disabled' : 'btn'">
						<i class="icon-fast-forward"></i>
					</a>
				</form>
			</div>
		</div>
	</div>

	<div class="row-fluid">
		<table class="table table-striped table-bordered">
			<thead>
			<tr>
				<th class="span4">学号</th>
				<th class="span4">姓名</th>
				<th class="span3">班级</th>
				<th>&nbsp;</th>
			</tr>
			</thead>
			<tbody>
			<tr th:each="student : ${page.records}">
				<td th:text="${student.number}"></td>
				<td th:text="${student.name}"></td>
				<td th:text="${student.studentClass}"></td>
				<td>
					<a th:href="@{'/teacher/student/delete/' + ${examId} + '/' + ${student.id}}"><i class="icon-trash" title="删除"></i></a>
				</td>
			</tr>
			</tbody>
		</table>
	</div>


	<div class="row-fluid">
		<div class="pull-right">
			<form class="form-inline" th:action="@{/teacher/student/changePage}" method="post">
				<a title="第一页"
				   th:href="@{'/teacher/student/'+ ${examId} +'/1'}"
				   th:classappend="${page.current == 1} ? 'btn disabled' : 'btn'">
					<i class="icon-fast-backward"></i>
				</a>
				<a title="前一页"
				   th:href="@{/teacher/student/{eid}/{pageNumber}(eid = ${examId},pageNumber=${page.current}-1)}"
				   th:classappend="${page.current == 1} ? 'btn disabled' : 'btn'">
					<i class="icon-step-backward"></i>
				</a>
				<input type="hidden" name="eid" th:value="${eid}" />
				<input type="hidden" name="pages" th:value="${page.pages}" />
				<input type="text" name="pageNo"
					   th:placeholder="${page.current}+ '/' +${page.pages}"
					   class="input-small" />
				<button type="submit" title="前往" class="btn">
					<i class="icon-play"></i>
				</button>
				<a title="后一页"
				   th:href="@{/teacher/student/{eid}/{pageNumber}(eid=${examId},pageNumber=${page.current}+1)}"
				   th:classappend="${page.current == page.pages} ? 'btn disabled' : 'btn'">
					<i class="icon-step-forward"></i>
				</a>
				<a title="最后一页"
				   th:href="@{'/teacher/student/' + ${page.pages}}"
				   th:classappend="${page.current == page.pages} ? 'btn disabled' : 'btn'">
					<i class="icon-fast-forward"></i>
				</a>
			</form>
		</div>
	</div>

	<form id="stuUpForm" class="exam-form form-inline" th:action="@{/teacher/student/upload}"
		enctype="multipart/form-data" method="post">
		<h4>批量导入学生名单</h4>
		<input type="hidden" name="eid" th:value="${examId}" />
		<input type="file" name="students" /> <input type="submit"
			class="btn btn-primary" id="impStu" value="导入" />
	</form>
</div>

<div th:replace="include/teacher_footer::footer"></div>
